package com.yincb;

import com.yincb.entity.Account;
import com.yincb.entity.User;
import com.yincb.entity.mapper.AccountMapper;
import com.yincb.entity.mapper.UserMapper;
import com.yincb.service.AccountService;
import com.yincb.service.UserService;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;

import javax.annotation.Resource;
import java.util.List;

@SpringBootTest
class MuiltDataresourceDemo {


    @Resource
    private UserMapper userMapper;

    @Resource
    private AccountMapper accountMapper;


    @Resource
    private UserService userService;

    @Resource
    private AccountService accountService;

    @Test
    void test() {

        //DynamicDataSourceHelper.setDynaDBKey(DataSourceConstants.DS_KEY_YCB02);
        List<Account> accounts = accountMapper.selectList(null);
        System.out.println(accounts);

        //DynamicDataSourceHelper.setDynaDBKey(DataSourceConstants.DS_KEY_YCB01);
        List<User> users = userMapper.selectList(null);
        System.out.println(users);

    }


    @Test
    void test1(){
        System.out.println(userService.select());

        System.out.println(accountService.select());
    }

}
